<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>酒店信息系统</title>
<link type="text/css" rel="stylesheet"  href="__PUBLIC__/css/style.css">
<link type="text/css" rel="stylesheet"  href="__PUBLIC__/css/page.css" />

<script src="__PUBLIC__/js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script language="javascript">
function checkallstu(o) {
	if(o.checked){
		$("input[name='roombox']").attr("checked",true);
	}else{
		$("input[name='roombox']").attr("checked",false);
	}
}
function aadd(){
	$("#show").show();
}

function delall(){
    var arr="";
    $("input[name=roombox]:checked").each(function(){
    	arr+=$(this).val()+",";
    })
    if(arr==""){
    	alert('请选择要删除的记录');
		return false; 
    }
    if (confirm("您确定要删除吗？")){
         $.post("__APP__/system/delallhotel",{
    	arr : arr
	    }, function(data) {
		if(data.msg=="1"){
			alert("删除成功");
			location.reload();
		}else{
			alert("删除失败");
	    	}
	    },"json");
    }else{
       return false;}
}
function edit(val,flag){
    var json=JSON.parse(val);

	$("#id").val(json.id);
	$("#hotel").val(json.hotel);
	$("#hotelName").val(json.hotelName);
    $("#hotelIP").val(json.ipaddr);
    $("#starlevel").val(json.starlevel);
    var movieInfo=json.demand.split("@");

    var name =movieInfo[0];
    var phone =  movieInfo[1];
    var landline=movieInfo[2];
    var email=movieInfo[3];
    var other=movieInfo[4];
    $("#name").val(name);
    $("#phone").val(phone);
    $("#landline").val(landline);
    $("#email").val(email);
    $("#other").val(other);
    $("#show").show();
}


function subsou(){
	var souname = $("#souname").val();
	window.location.href='__APP__/system/hotelName?name='+souname;
}
</script>
</head>

<body>
{include file="public/head"} 

</div>
<div class="content_2 clear">
{include file="system/left"}
<div class="content_3 left">
  <div class="content_3_wz"><img src="__PUBLIC__/images/dajt.png" />系统维护 &gt; 管理酒店</div>
  <div class="content_3_fdj"><img src="__PUBLIC__/images/fdj.jpg" /></div>
  <div class="content_3_xian"></div>
  <div class="content_3_ss clear">
     <ul>
      <li><span class="ctt_wd left">酒店名称查找：</span>
          <input id='souname'  name="text2" type="text" class="layui-input" />
      </li>
      <li class="ss_cx"><a href="#" onClick="subsou()">查询</a></li>

    </ul>
  </div>
    <table class="layui-table" lay-skin="line" >
   <thead >
      <tr>
        <td width="75">选择</td>
        <td width="85">编号</td>
        <td width="267">酒店名</td>
        <td width="261" >酒店程序名</td>

         <td width="180">操作</td>
      </tr>
    </thead>
    <tbody>
     <?
     if($roomArr){
      foreach($roomArr as $val){
        $tmp = addslashes(json_encode($val));
     ?>
      <tr >
        <td><input  type="checkbox" name="roombox" id="roombox"  value="{$val[id]}"></td>
        <td>{$val[id]}</td>
        <td>{$val[hotel]}</td>
        <td >{$val[hotelName]}</td>

        <td>
        <a href="#" class="layui-btn layui-btn-sm" onclick='edit("{$tmp}",2)'>修改 </a>
        </td>
      </tr>
    <?php 
		}
	}?>
    </tbody>
  </table>
  <div class="content_1234">
    <div class="content_glcz">管理操作：全选
      <input type="checkbox"  onClick="checkallstu(this)" />
        <input name="submit" type="submit" value="删除"  onclick="delall()" class="layui-btn layui-btn-sm layui-btn-warm"/>
        <input name="submit2" type="button" value="添加酒店" onclick="aadd()" class="layui-btn layui-btn-sm"/>
    </div>
    <div class="layui-box layui-laypage layui-laypage-default">{$page}</div>
  </div>

    <FORM action="__APP__/system/addhotel" enctype="multipart/form-data"method="post" >
        <div id="show" style="DISPLAY:none" class="show">
            <table class="layui-table" lay-skin="line">
               <thead >
                <tr>
                    <td colspan="2">酒店名管理</td>
                    <input type="hidden" id="id" name="id">

                </tr>
                </thead>
                <tbody>
                <tr class="ctt_gr">
                    <td width="154" align="right">酒店名：</td>
                    <td width="338" align="left">
                        <input class="textField_hp1"  size="20" id="hotel" name="hotel"/>
                    </td>
                </tr>
                <tr class="ctt_gr">
                    <td align="right">酒店程序名称：</td>
                    <td align="left">
                        <input class="textField_hp1"  size="20" id="hotelName" name="hotelName"/>
                    </td>
                </tr>
                <tr class="ctt_gr">
                    <td align="right">酒店vpnIP：</td>
                    <td align="left">
                        <input class="textField_hp1"  size="20" id="hotelIP" name="hotelIP"/>
                    </td>
                </tr>

                <tr>
                    <td align="right">所属地区：</td>
                    <td align="left"><span>省：<select id="p" name="p">
                        <?
    			if($list1){ foreach($list1 as $list){
    				if($list['assign']==$code1){
    		?>
                        <option value="{$list['assign']}" selected="selected">{$list['cityName']}</option>
                        <? }else{ ?>
                        <option value="{$list['assign']}" >{$list['cityName']}</option>
                        <?}}}?>
                    </select>
                        </span>
                    <span>市：<select id="c" name="c">
                        <?
    			if($list2){ foreach($list2 as $list){
					if($list['assign']==$code2){
    		?>
                        <option value="{$list['assign']}" selected="selected">{$list['cityName']}</option>
                        <? }else{ ?>
                        <option value="{$list['assign']}">{$list['cityName']}</option>
                        <?}}}?>
                    </select>
                    </span>
                    <span>县：<select id="x" name="x">
                        <?
    			if($list3){ foreach($list3 as $list){
					if($list['assign']==$code3){
    		?>
                        <option value="{$list['assign']}" selected="selected">{$list['cityName']}</option>
                        <? }else{ ?>
                        <option value="{$list['assign']}" >{$list['cityName']}</option>
                        <?}}}?>
                    </select>
                    </span>
                    </td>
                </tr>
                <tr class="ctt_gr">
                    <td align="right">酒店星级：</td>
                    <td align="left">
                        <select id="starlevel" name="starlevel">
                            <option value="7">☆☆☆☆☆☆☆</option>
                            <option value="6">☆☆☆☆☆☆</option>
                            <option value="5">☆☆☆☆☆</option>
                            <option value="4">☆☆☆☆</option>
                            <option value="3">☆☆☆</option>
                            <option value="2">☆☆</option>
                            <option value="1">☆</option>
                        </select>
                    </td>
                </tr>
                <tr class="ctt_gr">
                    <td width="154" align="right">联系人：</td>
                    <td width="338" align="left">
                        <input class="textField_hp1"  size="20" id="name" name="name"/>
                    </td>
                </tr>
                <tr class="ctt_gr">
                    <td align="right">手&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                    <td align="left"><input class="textField_hp1" size="15" id="phone" name="phone"/></td>
                </tr><tr class="ctt_gr">
                    <td align="right">座&nbsp;&nbsp;&nbsp;&nbsp;机：</td>
                    <td align="left"><input class="textField_hp1" size="15" id="landline" name="landline" /></td>
                </tr><tr class="ctt_gr">
                    <td align="right">邮&nbsp;&nbsp;&nbsp;&nbsp;箱：</td>
                    <td align="left"><input class="textField_hp1" size="15" id="email" name="email" /></td>
                </tr><tr class="ctt_gr">
                    <td align="right">其&nbsp;&nbsp;&nbsp;&nbsp;他：</td>
                    <td align="left"><input class="textField_hp1" size="15" id="other" name="other"/></td>
                </tr>
                <tr class="ctt_gr">
                    <td height="31" colspan="2" align="center"><input name="submit22" type="submit" value="确定" border="0"  class="layui-btn" id="ok"/>
                        <input name="submit22" type="button" value="取消" border="0" onclick="document.getElementById
	('show').style.display='none'" class="layui-btn layui-btn-warm"/></td>
                </tr>
                </tbody>
            </table>
        </div>

    </FORM>


</div>
</div>
</body>
</html>
<script>
    $('select[name=\'p\']').bind('change',function(){
        var code=$('select[name=\'p\']').val();
        $.post("__APP__/system/getcity2",{
            code : code
        }, function(data) {
            $("#c").html(data);
            var code1=$('select[name=\'c\']').val();
            $.post("__APP__/system/getcity2",{
                code : code1
            }, function(data) {
                $("#x").html(data);
            });
        });
    });
    $('select[name=\'c\']').bind('change',function(){
        var code=$('select[name=\'c\']').val();
        $.post("__APP__/system/getcity2",{
            code : code
        }, function(data) {
            $("#x").html(data);
        });
    });
</script>